#ifndef ENIGMA_H
#define ENIGMA_H

#include <QString>

#define ROTORS_MAX_NUMB     5
#define ROTOR_LETTERS_NUMB  26

class Rotor;
class Plugboard;
class Reflector;

class Enigma
{
public:
    Enigma();
    ~Enigma();

    void installRotor(int pos, Rotor *rotor);
    void installPlugboard(Plugboard *plugboard);
    void installReflector(Reflector *reflector);
    void setStartPhase(const QString &start);
    void reset();
    char encryptChar(char ch);
    QString encryptText(const QString &text);

    void enableRotateFirst(bool enable);

private:
    Rotor *m_rotors[ROTORS_MAX_NUMB];
    Plugboard *m_plugboard;
    Reflector *m_reflector;

    QString m_startPhase;

    bool m_rotateFirst;
};

#endif // ENIGMA_H
